home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
jumpingrope.swf
/
scripts
/
frame_25
/
DoAction.as
Wrap
Text File
|
2007-10-01
|
11KB
|
420 lines
function upUserF(upN)
{
_root.jumpSound.start();
_root["user" + upN + "Down"] = "yes";
}
function downUserF(downN)
{
_root.downSound.start();
_root["user" + downN + "Down"] = "no";
}
function startGameF()
{
dep = 10;
stageCount = maxCount;
stageMaxN = stageCount;
userN = stageN;
nowTime = maxTime - (userN - 1) * danTime;
jumpingVis = "no";
var _loc2_ = 1;
while(_loc2_ <= maxUser)
{
_root["user" + _loc2_ + "Down"] = "no";
_root["user" + _loc2_ + "Up"] = "up";
_loc2_ = _loc2_ + 1;
}
attachMovie("ropeRun1","ropeRun1_mc",1);
_root.ropeRun1_mc._x = 200;
_root.ropeRun1_mc._y = 57;
attachMovie("ropeRun2","ropeRun2_mc",20);
_root.ropeRun2_mc._x = 200;
_root.ropeRun2_mc._y = 257;
attachMovie("line","line_mc",2);
_root.line_mc._x = 200;
_root.line_mc._y = 150;
attachMovie("user" + stageN + "_mc","userMc_" + stageN,dep++);
_root["userMc_" + stageN]._x = 150;
_root["userMc_" + stageN]._y = 90;
attachMovie("start","start_mc",1000);
_root.start_mc._x = 200;
_root.start_mc._y = 150;
ranRopeF();
_root.startSound.start();
start_mc.gotoAndPlay("startF");
}
function reStart()
{
if(stageN >= 4)
{
userN = 4;
}
else
{
userN = stageN;
}
times_mc.gotoAndStop(1);
ui_mc.gotoAndStop(1);
stageCount = maxCount + stageKindN * (userN - 1);
stageMaxN = stageCount;
jumpingVis = "no";
var _loc2_ = 1;
while(_loc2_ <= maxUser)
{
_root["user" + _loc2_ + "Down"] = "no";
_root["user" + _loc2_ + "Up"] = "up";
_loc2_ = _loc2_ + 1;
}
dep = 10;
reUserMakeF();
if(stageN == 3)
{
ropeMaxN = 20;
ropeDn = 3;
}
ranRopeF();
_root.startSound.start();
start_mc.gotoAndPlay("startF");
}
function ranRopeF()
{
randomN = random(3) + 1;
ranRopeN1 = stageMaxN / 5 * randomN;
}
function startRopeF()
{
nowF = "main";
if(soundon == "yes")
{
_root.backSound = new Sound(this);
_root.backSound.attachSound("backSoundM");
}
_root.backSound.start(0,999);
Key.addListener(keyListener);
ropeRun1_mc.gotoAndStop("ropeF");
ropeRun2_mc.gotoAndStop("ropeF");
line_mc.gotoAndStop("level" + userN);
if(nowTime == maxTime - (userN - 1) * danTime)
{
ui_mc.timer_mc.in_mc._xscale = 100;
nowTime = maxTime - (userN - 1) * danTime;
timeDn = 100 / parseInt(nowTime);
}
ropeN = 1;
nowRopeN = ropeMaxN;
ropeRunInter = setInterval(ropeRunF,nowRopeN);
timerInter = setInterval(timerF,500);
}
function ropeRunF()
{
if(stageCount == ranRopeN1)
{
nowRopeN = ropeMaxN;
clearInterval(ropeRunInter);
ropeRunInter = setInterval(ropeRunF,nowRopeN);
}
else
{
switch(stageCount)
{
case stageMaxN / 5 * 4:
nowRopeN = ropeMaxN - 1 * ropeDn;
clearInterval(ropeRunInter);
ropeRunInter = setInterval(ropeRunF,nowRopeN);
break;
case stageMaxN / 5 * 3:
nowRopeN = ropeMaxN - 2 * ropeDn;
clearInterval(ropeRunInter);
ropeRunInter = setInterval(ropeRunF,nowRopeN);
break;
case stageMaxN / 5 * 2:
nowRopeN = ropeMaxN - 3 * ropeDn;
clearInterval(ropeRunInter);
ropeRunInter = setInterval(ropeRunF,nowRopeN);
break;
case stageMaxN / 5 * 1:
nowRopeN = ropeMaxN - 4 * ropeDn;
clearInterval(ropeRunInter);
ropeRunInter = setInterval(ropeRunF,nowRopeN);
}
}
ropeRun1_mc.in_mc.gotoAndStop(ropeN);
ropeRun2_mc.in_mc.gotoAndStop(ropeN);
line_mc.in_mc.gotoAndStop(ropeN);
if(ropeN == 60)
{
ropeN = 1;
}
else
{
ropeN++;
}
}
function timerF()
{
nowTime--;
if(nowTime == 0)
{
clearInterval(timerInter);
ui_mc.timer_mc.in_mc._xscale = 0;
clearInterval(timerInter);
Key.removeListener(keyListener);
clearInterval(ropeRunInter);
var _loc2_ = 1;
while(_loc2_ <= userN)
{
_root["userMc_" + _loc2_].gotoAndStop("dist");
_loc2_ = _loc2_ + 1;
}
gaemOverInter = setInterval(gameOverF,20);
}
else
{
ui_mc.timer_mc.in_mc._xscale = parseInt(nowTime) * timeDn;
}
}
function reUserMakeF()
{
attachMovie("ropeRun1","ropeRun1_mc",1);
_root.ropeRun1_mc._x = 200;
_root.ropeRun1_mc._y = 57;
attachMovie("ropeRun2","ropeRun2_mc",20);
_root.ropeRun2_mc._x = 200;
_root.ropeRun2_mc._y = 257;
attachMovie("line","line_mc",2);
_root.line_mc._x = 200;
_root.line_mc._y = 150;
var _loc2_ = 1;
while(_loc2_ <= userN)
{
attachMovie("user" + _loc2_ + "_mc","userMc_" + _loc2_,dep++);
_loc2_ = _loc2_ + 1;
}
userMcWi = parseInt(_root.userMc_1._width) - 15;
switch(userN)
{
case 1:
_root["userMc_" + userN]._x = 150;
_root["userMc_" + userN]._y = 90;
break;
case 2:
_root["userMc_" + (userN - 1)]._x = 107.6;
_root["userMc_" + (userN - 1)]._y = 90;
_root["userMc_" + userN]._x = 185.4;
_root["userMc_" + userN]._y = 90;
break;
case 3:
_root["userMc_" + (userN - 2)]._x = 67;
_root["userMc_" + (userN - 2)]._y = 90;
_root["userMc_" + (userN - 1)]._x = 144.8;
_root["userMc_" + (userN - 1)]._y = 90;
_root["userMc_" + userN]._x = 226.1;
_root["userMc_" + userN]._y = 83;
break;
case 4:
_root["userMc_" + (userN - 3)]._x = 26.3;
_root["userMc_" + (userN - 3)]._y = 90;
_root["userMc_" + (userN - 2)]._x = 104.1;
_root["userMc_" + (userN - 2)]._y = 90;
_root["userMc_" + (userN - 1)]._x = 185.3;
_root["userMc_" + (userN - 1)]._y = 83;
_root["userMc_" + userN]._x = 266.6;
_root["userMc_" + userN]._y = 85;
}
}
function jumpingF(jumpN)
{
if(jumpN == 1)
{
var _loc2_ = 1;
while(_loc2_ <= userN)
{
_root["user" + _loc2_ + "jump"] = "no";
_loc2_ = _loc2_ + 1;
}
}
_root["jumpingVis" + jumpN] = "yes";
}
function jumpChcekF(chcekN)
{
jumpChceKV = "yes";
if(_root["user" + chcekN + "Down"] == "no")
{
_root.hitSound.start();
_root["userMc_" + chcekN].gotoAndStop("hit");
var _loc2_ = 1;
while(_loc2_ <= userN)
{
_root["user" + _loc2_ + "Down"] = "yes";
if(_loc2_ != chcekN)
{
_root["user" + _loc2_ + "jump"] = "yes";
}
_loc2_ = _loc2_ + 1;
}
stageEnd();
stageEndInter = setInterval(failureF,2000);
}
else if(chcekN == userN)
{
scoreF();
countF();
}
}
function stageEnd()
{
clearInterval(timerInter);
Key.removeListener(keyListener);
clearInterval(ropeRunInter);
var _loc2_ = 1;
while(_loc2_ <= userN)
{
if(_root["user" + _loc2_ + "jump"] == "yes")
{
_root["userMc_" + _loc2_].gotoAndStop("dist");
}
_loc2_ = _loc2_ + 1;
}
}
function gameOverF()
{
nowF = "noting";
_root.backSound.stop();
delete _root.backSound;
clearInterval(gaemOverInter);
var _loc2_ = 1;
while(_loc2_ <= stageN)
{
_root["userMc_" + _loc2_].removeMovieClip();
_loc2_ = _loc2_ + 1;
}
start_mc.removeMovieClip();
ropeRun1_mc.removeMovieClip();
ropeRun2_mc.removeMovieClip();
times_mc.gotoAndStop("hide");
line_mc.removeMovieClip();
_root.gameOverSound.start();
_root.gotoAndStop("gameOver");
}
function failureF()
{
nowF = "noting";
_root.backSound.stop();
delete _root.backSound;
clearInterval(stageEndInter);
var _loc2_ = 1;
while(_loc2_ <= stageN)
{
_root["userMc_" + _loc2_].removeMovieClip();
_loc2_ = _loc2_ + 1;
}
ropeRun1_mc.removeMovieClip();
ropeRun2_mc.removeMovieClip();
line_mc.removeMovieClip();
times_mc.gotoAndStop("hide");
_root.readySound.start();
failure_mc.gotoAndPlay(2);
}
function countF()
{
stageCount--;
if(0 == stageCount)
{
Key.removeListener(keyListener);
clearInterval(timerInter);
stageUpInter = setInterval(stageUpF,20);
}
}
function stageUpF()
{
clearInterval(stageUpInter);
Key.removeListener(keyListener);
clearInterval(ropeRunInter);
leverClearInter = setInterval(levelClear,20);
}
function levelClear()
{
clearInterval(leverClearInter);
times_mc.gotoAndStop("hide");
var _loc3_ = 1;
while(_loc3_ <= userN)
{
_root["userMc_" + _loc3_].removeMovieClip();
_loc3_ = _loc3_ + 1;
}
ropeRun1_mc.removeMovieClip();
ropeRun2_mc.removeMovieClip();
times_mc.gotoAndStop("hide");
line_mc.removeMovieClip();
_root.backSound.stop();
delete _root.backSound;
nowF = "levelClear";
if(soundon == "yes")
{
levelClearSound = new Sound(this);
levelClearSound.attachSound("levelClearSoundM");
}
_root.levelClearSound.start(0,999);
levelClear_mc.gotoAndPlay(2);
temp = parseInt(nowTime) * (parseInt(timebonus) / 2);
nowTime = maxTime - userN * danTime;
}
function ready()
{
stageN++;
nowF = "noting";
backN = stageN % 3 != 0 ? stageN % 3 : 3;
_root.back_mc.gotoAndStop(backN);
ui_mc.gotoAndStop(2);
_root.levelClearSound.stop();
delete _root.levelClearSound;
_root.readySound.start();
ready_mc.gotoAndPlay(2);
stageMaxN = maxCount + stageKindN * userN;
}
function scoreF()
{
game_score += 100;
}
function titleMoveF()
{
_root.gameOverSound.stop();
gotoAndStop("wait_start");
play();
}
nowF = "noting";
_root.titleSound.stop();
delete _root.titleSound;
_root.readySound.start();
maxUser = 4;
maxCount = 15;
maxTime = 280;
danTime = 20;
stageN = 1;
game_score = 0;
timebonus = 200;
maxLineN = 16;
minLineN = 2;
stageKindN = 5;
ropeMaxN = 23;
ropeDn = 3;
var keyListener = new Object();
keyListener.onKeyUp = function()
{
if(Key.getCode() == 90)
{
_root.user1Up = "up";
}
if(Key.getCode() == 88)
{
_root.user2Up = "up";
}
if(Key.getCode() == 67)
{
_root.user3Up = "up";
}
if(Key.getCode() == 86)
{
_root.user4Up = "up";
}
};